<?php 
defined('IN_TS') or die('Access Denied.');

$userid = aac('user')->isLogin();

$page = isset($_GET['page']) ? intval($_GET['page']) : 1;

$lstart = $page*30-30;

$all = intval($_GET['all']);

$first = intval($_GET['first']);

if($all){
    if($TS_USER['isadmin']==0){
        tsNotice('你没有操作权限');
    }
    $arr = '';
}else{
    $arr = 'userid='.$userid.' or touserid='.$userid;
}


$url = tsUrl('user','cardlist',array('all'=>$all,'page'=>''));

//全部任务
$arrCard = aac('user')->findAll('user_card',$arr,'sendtime desc,cardid desc',null,$lstart.',30');

foreach($arrCard as $key=>$item){

    $arrCard[$key]['user'] = aac('user')->getOneUser($item['userid']);
    $arrCard[$key]['touser'] = aac('user')->getOneUser($item['touserid']);
}

$cardNum = aac('user')->findCount('user_card',$arr);

$pageUrl = pagination($cardNum, 30, $page, $url);

$title = '贺卡';
include template("cardlist");